<template>
  <div id="userLayout" :class="['user-layout-wrapper', device]">
    <!-- PC view-->
    <div class="container" id='container' v-if='pc'>
      <div class="top">
        <div class="header">
<!--            <img class="logo" src="~@/assets/logo.png"  alt="珠宝精灵">-->
            <span class="title">珠宝精灵</span>
        </div>
      </div>
      <div class="input-area">
        <div class='input-area-inner'>
          <div class='desccontext' ><img src='../../assets/login_text.png' width='450px' height='260px'></div>
          <div class="inputview"> <route-view ></route-view></div>
        </div>
      </div>

    </div>
<!-- mobile view-->
    <div class="container-mobile" v-else-if='!pc'>
      <div class="top">
        <div class="header">
          <img class="logo" src="~@/assets/logo.png"  alt="珠宝精灵">
          <span class="title">珠宝精灵</span>
        </div>
      </div>
       <route-view class='route-view' ></route-view>

    </div>
  </div>
</template>

<script>
  import RouteView from "@/components/layouts/RouteView"
  import { mixinDevice } from '@/utils/mixin.js'
  import vue from 'vue'

  export default {
    name: "UserLayout",
    components: { RouteView },
    mixins: [mixinDevice],
    data () {
      return {
        pc:true
      }
    },
    methods:
    {
      loadMobilePage:function()
      {
        var bs = {
          versions: function() {
            var u = navigator.userAgent, app = navigator.appVersion;
            return {//移动终端浏览器版本信息
              trident: u.indexOf('Trident') > -1, //IE内核
              presto: u.indexOf('Presto') > -1, //opera内核
              webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
              gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
              mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //是否为移动终端
              ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
              android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
              iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
              iPad: u.indexOf('iPad') > -1, //是否iPad
              webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
            };
          } (),
          language: (navigator.browserLanguage || navigator.language).toLowerCase()
        }
        if (bs.versions.mobile) {
          if (bs.versions.iPad) { }
          else if (bs.versions.android || bs.versions.iPhone || bs.versions.ios) {
          this.pc=false

          }
        }
      }
    },
    mounted: function() {
      document.body.classList.add('userLayout')
      this.loadMobilePage()
    },
    beforeDestroy () {
      document.body.classList.remove('userLayout')
    },

  }




</script>

<style lang="less" scoped>
  #userLayout.user-layout-wrapper {
    height: 100%;

    &.mobile {
      .container {
        .main {
          max-width: 368px;
          width: 98%;
        }
      }
    }
    //PC Style
    .container {
      width: 100%;
      min-height: 100%;
      background: #f0f2f5 url(~@assets/bg1.jpg) no-repeat 50%;
      background-size: 100%;
      padding: 110px 0 144px;

      a {
        text-decoration: none;
        color: #8cc8ff;
      }

      .top {
        .header {
          height: 50px;
          line-height: 50px;

          .badge {
            position: absolute;
            display: inline-block;
            line-height: 1;
            vertical-align: middle;
            margin-left: -12px;
            margin-top: -10px;
            opacity: 0.8;
          }

          .logo {
            height: 50px;
            vertical-align: top;
            margin-left: 30px;
          }

          .title {

            font-size: 40px;
            //color: rgba(0, 0, 0, .85);
            color: #ffffff;
            //font-family: "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
            font-family: 幼圆;
            font-weight: 500;
            position: relative;
            margin-left: 100px;

          }
        }
      }

      .input-area {
        width: 100%;
        height: 600px;
        //background-color: #cccc77;
        font-size: 14px;
        color: rgba(0, 0, 0, 0.45);
        text-align: center;
        vertical-align: center;

        //filter:alpha(opacity=80);
        //-moz-opacity:0.8;
        //-khtml-opacity: 0.8;
        //opacity: 0.8;
        .input-area-inner {
          width: 900px;
          height: 600px;
          line-height: 600px;
          //background-color: #00DB00;
          margin: 0 auto;


          .desccontext {

            float: left;
            //background-color: #152ede;
            vertical-align: middle;
          }

          .inputview {

            float: right;
            position: absolute;
            top: 50%;
            //left: 50%;
            height: 30%;
            width: 50%;
            margin: -10% 0 0 20%;
          }

        }
      }

      .main {
        min-width: 260px;
        width: 368px;
        margin: 0 auto;
      }

      .footer {
        position: absolute;
        width: 100%;
        bottom: 0;
        padding: 0 16px;
        margin: 48px 0 24px;
        text-align: center;

        .links {
          margin-bottom: 8px;
          font-size: 14px;
          a {
            //color: rgba(0, 0, 0, 0.45);
            color: rgba(255, 255, 255, 0.85);
            transition: all 0.3s;
            &:not(:last-child) {
              margin-right: 40px;
            }
          }
        }
        .copyright {
          //color: rgba(0, 0, 0, 0.45);
          color: rgba(255, 255, 255, 0.85);
          font-size: 14px;
        }
      }
    }
    //Mobile Style
    .container-mobile {
      width: 100%;
      min-height: 100%;
      //background: #f0f2f5 url(~@assets/bg1.jpg) no-repeat 50%;
      background-color: #2F54EB;
      background-size: 100%;
      padding: 110px 0 144px;
      text-align: center;
      vertical-align: middle;
      a {
        text-decoration: none;
        color: #8cc8ff;
      }

      .top {
        .header {
          height: 50px;
          line-height: 50px;


          .logo {
            height: 50px;
            vertical-align: top;

          }

          .title {

            font-size: 40px;
            //color: rgba(0, 0, 0, .85);
            color: #ffffff;
            //font-family: "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
            font-family: 幼圆;
            font-weight: 500;
            position: relative;
            margin-left: 10px;

          }
        }
      }

      .route-view {
       //margin-top: 50px;
       margin: 50px 10px;

      }

      .footer {
        position: absolute;
        width: 100%;
        bottom: 0;
        padding: 0 16px;
        margin: 48px 0 24px;
        text-align: center;

        .links {
          margin-bottom: 8px;
          font-size: 14px;
          a {
            //color: rgba(0, 0, 0, 0.45);
            color: rgba(255, 255, 255, 0.85);
            transition: all 0.3s;
            &:not(:last-child) {
              margin-right: 40px;
            }
          }
        }
        .copyright {
          //color: rgba(0, 0, 0, 0.45);
          color: rgba(255, 255, 255, 0.85);
          font-size: 14px;
        }
      }
    }
  }
</style>